home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / scheme / schematk / src_1152.lha / Agent.subproj / InfoAgent.m < prev    next >
Encoding:
Text File  |  1991-12-15  |  3.2 KB  |  106 lines

  1. /* Copyright รก 1991 Gustavus Adolphus College.  All rights reserved.
  2.  *
  3.  * Schematik was developed by Gustavus Adolphus College (GAC) with
  4.  * support from NeXT Computer, Inc.  Permission to copy this software,
  5.  * to redistribute it, and to use it for any purpose is granted,
  6.  * subject to the following restrictions and understandings.
  7.  *
  8.  * 1. Any copy made of this software must include this copyright
  9.  * notice in full.
  10.  *
  11.  * 2. Users of this software agree to make their best efforts (a) to
  12.  * return to the GAC Mathematics and Computer Science Department any
  13.  * improvements or extensions that they make, so that these may be
  14.  * included in future releases; and (b) to inform GAC of noteworthy
  15.  * uses of this software.
  16.  *
  17.  * 3. All materials developed as a consequence of the use of this
  18.  * software shall duly acknowledge such use, in accordance with the
  19.  * usual standards of acknowledging credit in academic research.
  20.  *
  21.  * 4. GAC makes no express or implied warranty or representation of
  22.  * any kind with respect to this software, including any warranty
  23.  * that the operation of this software will be error-free.  ANY
  24.  * IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
  25.  * PURPOSE IS HEREBY DISCLAIMED.  GAC is under no obligation to
  26.  * provide any services, by way of maintenance, update, or otherwise.
  27.  *
  28.  * 5. In conjunction with products arising from the use of this
  29.  * material, there shall be no use of the name of Gustavus Adolphus
  30.  * College nor of any adaptation thereof in any advertising,
  31.  * promotional, or sales literature without prior written consent
  32.  * from GAC in each case.
  33.  */
  34.  
  35. #import "InfoAgent.h"
  36. #import "../defines.h"
  37. #import Main_h
  38. #import PrefAgent_h
  39. #import <appkit/Matrix.h>
  40. #import <mach.h>
  41.  
  42. #define NIBFILE1    "Info.nib"
  43. #define NIBFILE2    "Licenses.nib"
  44. #define INFOZONENAME    "InfoAgnt"
  45. static id theAgent=nil;
  46.  
  47. @implementation InfoAgent
  48.  
  49. + new
  50. {
  51. DEBUG_FUNC1(DEBUGLEVEL);
  52.     if (theAgent==nil)
  53.       {
  54.         NXZone *tempZone;
  55.  
  56.         tempZone = NXCreateZone(vm_page_size, vm_page_size, YES);
  57.         DEBUG_ASSERT(tempZone!=NULL)
  58.         theAgent = self = [super allocFromZone:tempZone];
  59.     agentZone = tempZone;
  60.     NXNameZone(agentZone, INFOZONENAME);
  61.       }
  62.     return theAgent;
  63. }
  64.  
  65. - activateAgent:sender
  66. {
  67. DEBUG_FUNC1(DEBUGLEVEL);
  68.     switch ([sender tag])
  69.       {
  70.         case MENU_INFO_InfoPanel: if (!infoPanel)
  71.                                     {
  72.                       infoPanel = LoadNIB(NIBFILE1, theAgent, agentZone);
  73.                       DEBUG_ASSERT(infoPanel!=nil)
  74.                       [infoPanel useOptimizedDrawing:YES];
  75.                     }
  76.                   [infoPanel makeKeyAndOrderFront:self];
  77.                   break;
  78.         case MENU_INFO_License  : if (!licensePanel)
  79.                     {
  80.                       licensePanel = LoadNIB(NIBFILE2, theAgent, agentZone);
  81.                       DEBUG_ASSERT(licensePanel!=nil)
  82.                       [licensePanel useOptimizedDrawing:YES];
  83.                       [licensePanel setTitle:LICENSEPANELTITLE];
  84.                     }
  85.                   [licensePanel center];
  86.                   [licensePanel makeKeyAndOrderFront:self];
  87.       }
  88.     return self;
  89. }
  90.  
  91. @end
  92.  
  93. @implementation InfoAgent (Delegate)
  94.  
  95. - windowWillClose:sender
  96. {
  97. DEBUG_FUNC1(DEBUGLEVEL);
  98.     if ([sender isEqual:infoPanel])
  99.       infoPanel = nil;
  100.     else if ([sender isEqual:licensePanel])
  101.       licensePanel = nil;
  102.     return self;
  103. }
  104.  
  105. @end
  106.